import request from '@/utils/request'

// 获取任务节点信息
export function listNode(data) {
    return request({
        url: '/api/host',
        method: 'get',
        params: data
    })
}

export function addNode(data) {
    return request({
        url: '/api/host/store',
        method: 'post',
        data: data
    })
}

export function updateNode(data) {
    return request({
        url: '/api/host/store',
        method: 'post',
        data: data
    })
}
export function getNode(id){
    return request({
        url: '/api/host/' + id,
        method: 'get'
    })
}
export function ping(id){
    return request({
        url: '/api/host/ping/' + id,
        method: 'get'
    })
}
export function delNode(id){
    return request({
        url: '/api/host/remove/' + id,
        method: 'post'
    })
}
export function listJob(data){
    return request({
        url: '/api/task',
        method: 'get',
        params: data
    })
}
export function hostAll(){
    return request({
        url: '/api/host/all',
        method: 'get'
    })
}
export function save(data){
    return request({
        url: '/api/task/store',
        method: 'post',
        data: data
    })
}
export function disableTask(id){
    return request({
        url: '/api/task/disable/'+id,
        method: 'post'
    })
}
export function enableTask(id){
    return request({
        url: '/api/task/enable/'+id,
        method: 'post'
    })
}
export function runTask(id){
    return request({
        url: '/api/task/run/'+id,
        method: 'get'
    })
}
export function getJob(id){
    return request({
        url: '/api/task/'+id,
        method: 'get'
    })
}
export function delJob(id){
    return request({
        url: '/api/task/remove/'+id,
        method: 'post'
    })
}
export function listJobLog(data){
    return request({
        url: '/api/task/log',
        method: 'get',
        params: data
    })
}
export function stopTask(data){
    return request({
        url: '/api/task/log/stop',
        method: 'post',
        params: data
    })
}
export function cleanJobLog(type){
    return request({
        url: '/api/task/log/clear/'+type,
        method: 'delete',
    })
}